//
//  XJYWelcomeViewController.m
//  高仿萝卜书摘
//
//  Created by 谢俊逸 on 2016/11/27.
//  Copyright © 2016年 谢俊逸. All rights reserved.
//

#import "XJYWelcomeViewController.h"
#import "XJYHeader.h"
#import "XJYLoginViewController.h"
#import "XJYRegisterViewController.h"

@interface XJYWelcomeViewController ()

@property (nonatomic,strong) FUIButton *loginButton;
@property (nonatomic,strong) FUIButton *registerButton;

@end

@implementation XJYWelcomeViewController

- (void)viewDidLoad {
    
    
    [super viewDidLoad];
    self.view.backgroundColor = [UIColor whiteColor];
    [self.view addSubview:self.loginButton];
    [self.view addSubview:self.registerButton];
    
    
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
}

- (FUIButton *)loginButton{
    FUIButton *loginButton = [[FUIButton alloc]initWithFrame:RectMake_LFL(375/4-75, 667/5*4, 150, 50)];
    [loginButton setButtonColor:[UIColor greenSeaColor]];
    [loginButton setTitle:@"登陆" forState:UIControlStateNormal];
    [loginButton addTarget:self action:@selector(loginButtonClicked:) forControlEvents:UIControlEventTouchUpInside];
    loginButton.cornerRadius = 20;
    
    return loginButton;
}

- (FUIButton *)registerButton{
    FUIButton *registerButton = [[FUIButton alloc]initWithFrame:RectMake_LFL(375/4*3-75, 667/5*4, 150, 50)];
    [registerButton setButtonColor:[UIColor colorWithWhite:1 alpha:0.9]];
    [registerButton setTitle:@"注册" forState:UIControlStateNormal];
    [registerButton setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
    registerButton.layer.borderWidth = 2;
    registerButton.layer.backgroundColor = (__bridge CGColorRef _Nullable)([UIColor greenSeaColor]);
    registerButton.layer.cornerRadius = 20;
    registerButton.layer.masksToBounds = YES;
    [registerButton addTarget:self action:@selector(registerButtonClicked:) forControlEvents:UIControlEventTouchUpInside];
    return registerButton;
}




#pragma mark buttonClicked

- (void)loginButtonClicked:(UIButton *)button{
    NSLog(@"login Button CLicked");
    XJYLoginViewController *loginC = [[XJYLoginViewController alloc]init];
    [self presentViewController:loginC animated:YES completion:^{
        
    }];
}
- (void)registerButtonClicked:(UIButton *)button{
    NSLog(@"register Button CLicked");

    XJYRegisterViewController *registerC = [[XJYRegisterViewController alloc]init];
    UINavigationController *registerNav = [[UINavigationController alloc]initWithRootViewController:registerC];
    [self presentViewController:registerNav animated:YES completion:^{
        
    }];
}
@end
